package org.dynamic.test;

import org.dynamic.util.SpringContextUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.defonds.scheduler.jobs.Hello;

@Component
public class QuartzManager implements BeanFactoryAware{
	
	private  BeanFactory beanFactory;
	
	@Override
	public void setBeanFactory(BeanFactory factory) throws BeansException {
			this.beanFactory = factory;
		
	}
	/*@Scheduled(cron="0 0/4 * * * ? ")
	public void testHello(){
		Hello hello = (Hello)beanFactory.getBean("hello");
		hello.hello();
	}*/
	
	@Scheduled(cron="0 0/1 * * * ? ")
	public void testHello(){
		Hello hello = (Hello) SpringContextUtil.getBean("hello");
		hello.hello();
	}
}
